import java.util.Locale;

import org.mentawai.core.Context;
import org.mentawai.db.JPAHandler;
import org.mentawai.filter.MentaContainerFilter;
import org.mentawai.filter.ValidatorFilter;
import org.mentawai.i18n.LocaleManager;

import rgil.actions.UsuarioAction;
import rgil.repository.UsuarioRepository;
import rgil.repository.impl.UsuarioDaoImpl;






public class ApplicationManager extends org.mentawai.core.ApplicationManager {

	@Override
	public void init(Context application) {
		
		LocaleManager.useMasterI18N(true);
		LocaleManager.usePrefixForActions(false);
		LocaleManager.add(new Locale("pt", "BR"));
		
		setAutowireEverything(true);
		setJPAHandler(new JPAHandler("PU_RGIL", true));
		
		ioc(UsuarioRepository.class, UsuarioDaoImpl.class);
	}
	
	@Override
	public void loadFilters() {
		filter(new MentaContainerFilter());
		filter(new ValidatorFilter());
	}
	
	@Override
	public void loadActions() {
	
		action(UsuarioAction.class)
			.on(MAIN ,"jsp/usuario/form.jsp")
			.on(ERROR, "jsp/usuario/form.jsp")
			.on(CREATED, redir("UsuarioAction.list.mtw"))
			.on(LIST, fwd("jsp/usuario/list.jsp"));
		
	}
	
}
